﻿<include file="Public/head"/>
<div class="container-fluid">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">添加自定义菜单</h3>
    </div>
    <div class="modal-body">
        <form class="form-horizontal" method="post">
            <div class="control-group">
                <label class="control-label">菜单名称</label>
                <div class="controls">
                    <input type="text" name="name" placeholder="菜单名称" value="{$data.name}">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">上级菜单</label>
                <div class="controls">
                    <select name="pid">
                        <option value="0" <eq name="data.pid" value="0">selected</eq>>一级菜单</option>
                        <volist name="menu" id="vo">
                            <option value="{$vo.id}" <?php if($vo['id'] == $data['pid']){echo 'selected';}?>>{$vo.name}</option>
                        </volist>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">类型</label>
                <div class="controls">
                    <input type="radio" name='type' value="1" <eq name="data.type" value="1">checked</eq>/>关键字　
                    <input type="radio" name='type' value="2" <eq name="data.type" value="2">checked</eq>/>跳转
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">跳转地址/关键字</label>
                <div class="controls">
                    <input id="key" type="text" placeholder="跳转地址/关键字" value='<empty name="data.key">{$data.url}<else/>{$data.key}</empty>'>
                </div>
            </div>
            <input type="hidden" name="id" value="{$data.id}">
        </form>
    </div>
    <div class="modal-footer">
        <button class="btn" onclick='history.go(-1)'>返回</button>
        <button class="btn btn-primary" id="add" onclick="add();">保存</button>
    </div>
</div>
<include file="Public/foot"/>
<script>
    $("input[type='radio']").click(function(){
        if($(this).val() == 1){
            $('#key').attr('name','key');
        }else{
            $('#key').attr('name','url');
        }
    });
    $('input:checked').click();
</script>
